let http = require("http");
let url = require("url");
let fs = require("fs");

const ContentTypeHtml = {'Content-Type': 'text/html; charset=utf-8'}
http.createServer((req, res) => {
    let pathname = url.parse(req.url).pathname;
    console.log(pathname);
    switch (pathname) {
        case '/': {
            let dirs = fs.readdirSync(".");
            res.writeHead(200, ContentTypeHtml);
            res.write(JSON.stringify(dirs))
            break
        }
        case '/index.html': {
            break
        }
        default: {
        }
    }
}).listen(8088, "192.168.0.251")
